#ifndef NAV_CONTROLLER__LASER_UTIL_HPP_
#define NAV_CONTROLLER__LASER_UTIL_HPP_

#include <string>
#include <vector>
#include <memory>
#include "rclcpp/rclcpp.hpp"
#include <sensor_msgs/msg/laser_scan.hpp>
#include "rclcpp_lifecycle/lifecycle_node.hpp"

namespace nav_controller
{

  class LaserUtil
  {
  public:
    LaserUtil(rclcpp_lifecycle::LifecycleNode::SharedPtr &node);
    ~LaserUtil() ;
  
    rclcpp::Logger logger_{rclcpp::get_logger("LaserUtil")};

    sensor_msgs::msg::LaserScan::SharedPtr laser_msg_;
    rclcpp::Subscription<sensor_msgs::msg::LaserScan>::SharedPtr laser_sub_; // 订阅激光雷达数据
    /**
     * 接收雷达数据
     */
    void laser_callback(const sensor_msgs::msg::LaserScan::SharedPtr msg);
    
    float get_mid_distance();
  };

} // namespace nav_controller

#endif // NAV_CONTROLLER__LASER_UTIL_HPP_